package org.webcamp.questionary.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.webcamp.questionary.dao.QuestionaryDao;
import org.webcamp.questionary.dto.Answer;
import org.webcamp.questionary.dto.Question;
import org.webcamp.questionary.dto.Questionary;

public class TestQuestionaryDao implements QuestionaryDao {

	@Override
	public List<Questionary> getAllQuestionaries() {
		List<Questionary> questionaries = new ArrayList<>();
		for (int i = 0; i < 5; i++) {
			List<Question> questions = new ArrayList<>();
			for (int j = 0; j < 5; j++) {
				Question q = new Question();
				q.setText("Test question " + i + " - " + j);
				List<Answer> answers = new ArrayList<>();
				Answer a1 = new Answer();
				a1.setCorrect(true);
				a1.setText("Correct answer");
				Answer a2 = new Answer();
				a2.setCorrect(false);
				a2.setText("Incorrect answer");
				answers.add(a1);
				answers.add(a2);
				q.setAnswers(answers);
				questions.add(q);
			}
			Questionary questionary = new Questionary();
			questionary.setDescription("Description for Test questionary " + i);
			questionary.setName("Test questionary " + i);
			questionary.setQuestions(questions);
			questionaries.add(questionary);
		}

		return questionaries;
	}

}
